package com.lqs.blog.controller;

import com.lqs.blog.service.CategoryService;
import com.lqs.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("categorys")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    @GetMapping
    public Result categorys() {
        return categoryService.getAll();
    }

    @GetMapping("detail")
    public Result categoryDetail() {
        return categoryService.getAllDetail();
    }

    @GetMapping("detail/{id}")//类别id
    public Result categoryDetail(@PathVariable("id") Long id) {
        return categoryService.getCategoryById(id);
    }
}
